{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "from pathlib import Path\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "image_dir = Path(PATH_TO_UTKFace_IMAGE_DIR)\n",
    "ages = []\n",
    "\n",
    "for image_path in image_dir.glob(\"*.jpg\"):\n",
    "    image_name = image_path.name  # [age]_[gender]_[race]_[date&time].jpg\n",
    "    age, gender = image_name.split(\"_\")[:2]\n",
    "    ages.append(min(int(age), 100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD7CAYAAABjVUMJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAD3RJREFUeJzt3X+sZGV9x/H3R3CBrbToctdtNcta\no4VmqzS5MWjRYkMixbX1ByGpBimiW6NJ/cMfsRrStCZKqrZCUcsqStuQILIRXPmRaOgiQYRcDFWJ\naawNmJDdZVcRbAIs1m//mLPr7GWve++dOzN3z/N+JZud871n5jzPnbnnM8955pxJVSFJas8zpt0A\nSdJ0GACS1CgDQJIaZQBIUqMMAElqlAEgSY0yACSpUQaAJDXKAJCkRh077Qb8OieffHJt2rRp2s2Q\npKPKvffeu6+qZo603qoOgE2bNjE3NzftZkjSUSXJg4tZz0NAktQoA0CSGmUASFKjDABJapQBIEmN\nMgAkqVEGgCQ1ygCQpEYZAJLUqFV9JrCma9MHbzp4+4FLXzvFlkgaB0cAktQoA0CSGmUASFKjDABJ\napQBIEmNMgAkqVEGgCQ1ygCQpEYZAJLUKANAkhplAEhSowwASWqUASBJjTIAJKlRiwqAJOcnuSvJ\nHUmuS7I2yUuT3J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f5DLgBOD7DPW/qvbTv6u+fhy4rKoe7pYPec572ueNwB8C/1ZVrwR+yuD30Nt+V9Uu4Arg\nM0n+BniENl7fACcBe+fVHmbwWl+xfVwfA2APh/4ynna2cZ8keT7wFeDWqnongxfG+qGfHwfsn1Lz\nVlyS1wDPrqrrh8qHPOd963PnZ8B3q+q73fKXgP+jx/1O8mrgVVV1cVV9DLgfeCc97vOQfQx29MNm\nuvqK7eP6GADNnG2c5HjgamBrVd0CUFU/Ap6VZHO32gXALdNp4VhsAWa6ydAbgM3A39LvPgP8N7A2\nyQu75dcA36Hf/T4VOG5oeQ2Dd/t97jNwcGTzvSTnAHQTvfdX1VMM9mdv7+rPBc4A7lzOdnp5HkCS\ntzD4zoEDZxu/b8pNGoskB44F/nCofBvwVeCzwC+BnwAXVtUjk2/h+CXZWVVnJTmdnvc5yUuATwHP\nZDDSuxj4XXra7yS/AXwGOA14CnicwY7vJPrb591VtaG7fQqDN3hrGMyFXFRVD3bzAFcxmPsK8KGq\n+sayttfHAJAkHVkfDwFJkhbBAJCkRhkAktQoA0CSGmUASFKjDABJapQBIEmNMgAkqVH/D5KFUbIn\nfccyAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x103877128>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "_ = plt.hist(ages, range(100))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    ""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2.0
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}